|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectalgalcommand.io.ScheduleKeeper
public class ScheduleKeeper
This class is used to manipulate an object based on a schedule. It assumes that the title for each column is equivalent to the name of the method to which the (interpolated) values apply.
This class uses a thread to periodically update the variables.
| Constructor Summary | |
|---|---|
ScheduleKeeper()
default constructor, you must use createSchedule(), setTarget(), and setUpdatePeriodInMinutes() before using start() |
|
ScheduleKeeper(java.lang.Object target,
java.io.File schedule,
double minutes)
Initializes with the given targets and schedule |
|
| Method Summary | |
|---|---|
void |
abort()
Stops reading the schedule |
void |
createSchedule(java.io.File src)
Reads a file and initializes a schedule object from it |
java.lang.Object |
getTarget()
|
long |
getUpdatePeriod()
|
static void |
main(java.lang.String[] args)
|
void |
run()
deriodically updates the target, sleeping in between. |
void |
setTarget(java.lang.Object obj)
Sets the object to be updated periodically from the schedule |
void |
setUpdatePeriodInMinutes(double minutes)
Sets the update period |
void |
setUpdatePeriodInSeconds(double seconds)
Sets the update period |
void |
start()
Starts updating the target from the schedule |
void |
update()
Interpolates the schedule and then updates the target by invoking the methods named in the titles of the schedule file |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ScheduleKeeper()
public ScheduleKeeper(java.lang.Object target,
java.io.File schedule,
double minutes)
throws java.io.FileNotFoundException,
java.io.IOException
target - The object to be periodically modifiedschedule - A schedule file with coulmns whose labels correspond to
methods in the target object that take a double as a parameter.minutes - The update period, in minutes
java.io.FileNotFoundException - Thrown if schedule does not
exist
java.io.IOException - Thrown if schedule can not be read| Method Detail |
|---|
public void update()
public void createSchedule(java.io.File src)
throws java.io.FileNotFoundException,
java.io.IOException
src - File that holds schedule data
java.io.FileNotFoundException
java.io.IOExceptionpublic void start()
public void abort()
public void setTarget(java.lang.Object obj)
obj - The object to be manipulated. It should have public methods
that take a single double as the parameter and whose names
are used as the titles in the schedule filepublic java.lang.Object getTarget()
public long getUpdatePeriod()
public void setUpdatePeriodInMinutes(double minutes)
minutes - public void setUpdatePeriodInSeconds(double seconds)
seconds - public void run()
abort()
to stop.
run in interface java.lang.Runnablepublic static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||